home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 January - Disc 2
/
Macworld (1999-01) (Disk 2).dmg
/
Serious Demos
/
Symbolic Composer 4.2
/
Environment
/
System
/
CADAR
/
Lengths
/
quantize
< prev
next >
Wrap
Lisp/Scheme
|
1998-10-22
|
699b
|
31 lines
quantize length-list &rest quantize-levels
quantizes a length-list into closest
level. length-list can be ticks or ratios.
a few examples:
(setq rhy '(226 494 462 485 476 493 488 135 108 474 482))
(quantize rhy '1/24)
->(1/8 1/4 1/4 1/4 1/4 1/4 1/4 1/12 1/24 1/4 1/4)
(quantize rhy '1/20 '1/24 '1/28)
->(1/8 1/4 1/4 1/4 1/4 1/4 1/4 1/14 1/20 1/4 1/4)
(quantize rhy '1/64 '1/48)
->(1/8 1/4 15/64 1/4 1/4 1/4 1/4 1/16 1/16 1/4 1/4)
(setq rhy2 '(1/8 1/7 1/6 1/5 1/3))
(quantize rhy2 '1/8 '1/5)
->(1/8 1/8 1/5 1/5 3/8)
(defun randolph (l)
(+ (- (random 40) 20) l))
(setq rhy3 (mapcar #'randolph (mapcar #'get-tick rhy2)))
(quantize rhy3 '1/8 '1/7 '1/6 '1/5 '1/3)
->(1/8 1/7 1/6 1/5 1/3)